<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <script th:src="@{/}+'js/tool.js'"></script>
  <style type="text/css">
    .layui-form .layui-form-item{
      width:90%;
    }
    .layui-input-inline{
      width:350px!important
    }
  </style>

</head>
<body style="margin-top: 100px">
<form class="layui-form" lay-filter="myform" id="myform">
  <input type="hidden" name="id" id="id" th:value="${id}">
  <input type="hidden" name="delFlag" id="delFlag" value="1">
  <div class="layui-form-item">
    <label class="layui-form-label">入学年级</label>
    <div class="layui-input-inline">
      <input type="text" name="name" lay-verify="required" autocomplete="off" class="layui-input">
    </div>
  </div>
  <button id="submitBtn" class="layui-btn" style="display:none" lay-submit lay-filter="submitme">保存</button>
</form>

<script>
  var id = $("#id").val();
  layui.use(['form', 'table', 'laydate'], function(){
    var form = layui.form
            ,layer = layui.layer;
    form.on('submit(submitme)', function(data){
      var values = {};
      $(":input").each(function(i,v){
        if(v.name){
          if(v.name){
            values[v.name] = v.value;
          }
        }
      })
      axios.post("grade/save",values).then(res=>{
        if(res.data.code==1){
          layer.msg(ret.msg);
        }else{
          parent.loadGrid("main-table");
          layer.msg("保存成功");
          var index = parent.layer.getFrameIndex(window.name);
          parent.layer.close(index);
        }
      })
      return false;
    });
    if(id){
      loadData()
    }
    function loadData(){
      var entity = getEntityInfo(id,"grade/getById");
      form.val("myform",entity);
    }

  })
</script>
</body>
</html>

</body>
</html>